<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
</html>
<?php
	session_start();
	if (!isset($_SESSION['username'])) {
		echo "<script language='javascript'>";
		echo "alert('You have no permission to read this page!');";
		echo "history.back();";
		echo "</script>";
		header("location:../login.php");
	}else {
		//讀取message_controller.php
		require('../../Controller/message_controller.php');
		//讀取post
		$uid = $_SESSION['uid'];		
		$mid = $_POST['mid'];
		$senttoid = $_POST['senttoid'];
		$postComment=$_POST['postComment'];
		//echo $uid;
		//echo $senttoid;
		//echo $postMessage;
		//做輸入檢查
		$control = new Message_Controller();
		$control->sendComment($uid, $senttoid, $postComment, $mid);
		header("location:../index.php?id=$senttoid");
	}
?>